﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FirstForm
{
    
    public partial class Form1 : Form
    {
        private static int gold = 0;

        private static Player his = new Player();

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < 5; i++)
            {
                int q = RandomObject();
                listBox1.Items.Add(Item.Trinkets[q]);
            }
            //listBox3.Items.AddRange(his.Inventory.Item);

            listBox4.Items.Add(his.Int);
            listBox4.Items.Add(his.Str);
            listBox4.Items.Add(his.Dex);
            listBox4.Items.Add(his.Hrd);

            listBox5.Items.Add(his.WIL);
            listBox5.Items.Add(his.Apr);
            listBox5.Items.Add(his.Def);
        }
       
        private void button1_Click(object sender, EventArgs e)
        {
            gold++;
            textBox2.Text = gold.ToString();
            if (gold > -1)
            {
                if (gold == 0)
                {
                    label2.Text = " ";
                }
                if (gold > 0)
                {
                    label2.Text = "MONEY!!";
                }
                if (gold > 19)
                {
                    label2.Text = "MUCH MONEY!!!";
                }
                if (gold > 49)
                {
                    label2.Text = "I'MMA RICH!!!";
                }
                if (gold > 99)
                {
                    label2.Text = "SO MUCH MONEY!!!";
                }
            }
        }

       
        private void listBox1_DoubleClick(object sender, EventArgs e)
        {
            int u = 0;
            if (gold < Item.Trinkets[u].Price)
            {
                textBox1.Text = "Not enough gold!";
            }
            else
            {
                gold -= Item.Trinkets[u].Price;
                string g = gold.ToString();
                textBox2.Text = g;
                listBox2.Items.Add(listBox1.SelectedItem);  //Item.Trinkets[u]);
                listBox3.Items.Add(listBox1.SelectedItem);  //Item.Trinkets[u]);
                //his.Inventory.Add(Item.Trinkets[u]);
                textBox1.Text = "Bought.";
                listBox1.Items.Remove(listBox1.SelectedItem);
            }
        }

        private void listBoxHead_DragDrop(object sender, DragEventArgs e)
        {
            listBoxHead.Items.Add(listBox3.SelectedItem);
            listBox3.Items.Remove(listBox3.SelectedItem);
            //his.Int += Item.Trinkets[u].IntBoost;   etc.
            //OR
            //Equipped.Add(Item.Trinkets[u])
            //and before battle
            //his.Int += all IntBoosts in Equipped
        }

        private void button2_Click(object sender, EventArgs e)
        {
            //launch Form2
            //close off Form1
        }

        static int RandomObject()
        {
            Random r = new Random();
            return r.Next(0, 9);
        }
                                            
    }

}
